#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n;
    cin >> n;
    map<int, int> mp;
    int t = 0;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        if(mp.count(x)) t++;
        mp[x]++;
    }
    int ans = mp.size();
    cout << ans - (t & 1) << endl;
}

signed main() {
    int t = 1;
    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}